###########获取mac地址###########
import uuid
import socket
import sys
import time
def get_mac_address(): 
    mac=uuid.UUID(int = uuid.getnode()).hex[-12:]
    #print(mac)
    return mac
print(get_mac_address())


###########读取注册码文件###########
fi=open("zhucema.txt","r",encoding="utf-8")
#fi.seek(0)
a=fi.read()
if(len(a)==0):
    print("无")
else:
    print(a)
#print(a)
fi.close()



###########通信客户端###########

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 

# 获取本地主机名
#host = socket.gethostname()
host = "49.234.60.164"

# 设置端口号
port = 9999

# 连接服务，指定主机和端口
s.connect((host, port))

# 接收小于 1024 字节的数据

data = get_mac_address()

s.send(data.encode('utf-8'))
s.send(a.encode("utf-8"))
buf = s.recv(1024)
if len(buf):
    print ("服务端说:" + str(buf,"utf-8"))
